/*
*用于截图的基本数据结构
*/
#pragma once

#include "CoreMinimal.h"
#include "Camera/CameraTypes.h"
#include "UObject/NoExportTypes.h"
#include "imageInfo.generated.h"

class UWorld;

/*
*输出的格式
*/
UENUM(BlueprintType)
enum class EOutImageFormat : uint8
{
	None = 0,
	PNG,
	JPEG,
	//没有实现
	BMP,
	//没有实现
	WepP,
};

/*
*截取通道
*/
UENUM(BlueprintType)
enum class EScreenshotShowFlags : uint8
{
	Lit = 0,
	Unlit,
	Wireframe,
};

UENUM(BlueprintType)
enum class EColorGammaSpace : uint8
{
	Linear,
	/** A simplified sRGB gamma correction is applied, pow(1/2.2). */
	Pow22,
	/** Use the standard sRGB conversion. */
	sRGB,
	Invalid
};
/*
*图像基本设置
*/
USTRUCT(BlueprintType)
struct ST_SCREENSHOT_API FStoneImageInfo
{
	GENERATED_USTRUCT_BODY()

		FStoneImageInfo();

	UPROPERTY(BlueprintReadWrite)
		EOutImageFormat format;

	UPROPERTY(BlueprintReadWrite)
		int width;

	UPROPERTY(BlueprintReadWrite)
		int height;

	bool IsValid()const;
};



//截图设置
USTRUCT(BlueprintType)
struct ST_SCREENSHOT_API FScreenshotInfo
{
	GENERATED_USTRUCT_BODY()

		FScreenshotInfo();

	UPROPERTY(BlueprintReadWrite)
		FStoneImageInfo outImageInfo;

	UPROPERTY(BlueprintReadWrite)
		FMinimalViewInfo minimalViewInfo;

	UPROPERTY(BlueprintReadWrite)
		AActor* worldTargetActor;

	UPROPERTY(BlueprintReadWrite)
		EScreenshotShowFlags flags;

	//需要隐藏的actor或需要显示的acor
	UPROPERTY(BlueprintReadWrite)
		TArray<AActor*> ActorList;

	//是否只显示制定对象
	UPROPERTY(BlueprintReadWrite)
		bool ShowListOnly;

	UPROPERTY(BlueprintReadWrite)
		int FrameDelay;
	//是否强制Alpha值为1
	UPROPERTY(BlueprintReadWrite)
		bool forceAlphaToOne;

	bool IsValid()const;
	void Release();
};

//输出数据
USTRUCT(BlueprintType)
struct ST_SCREENSHOT_API FImageData
{
	GENERATED_USTRUCT_BODY()

		FImageData();

	UPROPERTY(BlueprintReadWrite)
		FStoneImageInfo infp;

	UPROPERTY(BlueprintReadWrite)
		TArray<FColor> colorData;

	UPROPERTY(BlueprintReadWrite)
		TArray<uint8> outData;
};

/**
 * 
 */
UCLASS()
class ST_SCREENSHOT_API UimageInfoLib : public UObject
{
	GENERATED_BODY()
public:
	UFUNCTION(BlueprintCallable, meta = (WorldContext = "wroldObj"))
		static UWorld* GetWorldFromObj(UObject* wroldObj);

		static  EViewModeIndex CastShowFlags(EScreenshotShowFlags showFlags);
};